#define paginate(currentPage, totalPage, link)
	#if(totalPage <= 0 || currentPage > totalPage) #return #end
	
	#setLocal(startPage = currentPage)
	#if (startPage < 1) #setLocal(startPage = 1) #end
	
	#setLocal(showPageNum = 7)
	
	
	#if (totalPage < showPageNum)
		#setLocal(startPage = 1)
		#setLocal(endPage = totalPage) 
	#else
		#if (currentPage > 3) 
			
			#if(currentPage+3 > totalPage)
				#setLocal(startPage = totalPage - 6)
				#setLocal(endPage = totalPage)
			#else
				#setLocal(startPage = currentPage - 3)
				#setLocal(endPage = currentPage + 3)
			#end
		#else
			#setLocal(startPage = 1)
			#setLocal(endPage = showPageNum) 
		#end
	#end
	
	
	<ul class="pagination">
		#if (currentPage == 1)
			<li class="disabled"><a href="#">上一页</a></li>
		#else
			<li class=""><a href="#" onclick="go(#(currentPage - 1))" class="">上一页</a></li>
		#end
			
		#for(i : [startPage..endPage])
			#if (currentPage == i)
				<li class="active"><a href="#">#(i)</a></li>
			#else
				<li class=""><a href="#" onclick="go(#(i))">#(i)</a></li>
			#end
		#end
			
		#if (currentPage == totalPage)
			<li class="disabled"><a href="#">下一页</a></li>
		#else
			<li class=""><a href="#" onclick="go(#(currentPage + 1))" class="" >下一页</a></li>
		#end
		
		<li>
		 	<a style="padding: 0px;"> <input type="text" name="" value="" id="pageNum" autocomplete="off"  style="width: 50px;border:0;text-align: center;height:32px;"/> </a>
		</li>
		<li> <a href="#" onclick="">go</a></li>
	</ul>
	<input type="hidden" name="pageNumber" value="#(currentPage)" id="pageNumber"/>
	<script type="text/javascript">
	function go(pageNum){
		var search = document.getElementById("search");
		var pageNumber = document.getElementById("pageNumber");
		
		if(search==null) return;
		
		if(undefined!=pageNum){
			if(pageNumber!=null){
				pageNumber.value = pageNum;
				search.submit();
				return;
			}
		}

		var num =  document.getElementById("pageNum");
		if(num!='' && isNaN(num)){
			pageNumber.value = num;
			search.submit();
		}
	}

	</script>

#end
